/*
 * @Author: pq yxqxq79@gmail.com
 * @Date: 2025-06-20 15:12:57
 * @LastEditors: pq yxqxq79@gmail.com
 * @LastEditTime: 2025-06-25 22:07:28
 * @FilePath: \order2-h5d:\小花\rcs-h5\src\assets\js\web3.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Web3 from "web3";

// ✅ 初始化 Web3（优先使用钱包注入的 provider，例如 MetaMask）
export const web3 = new Web3(
  Web3.givenProvider || new Web3.providers.HttpProvider("https://data-seed-prebsc-1-s2.binance.org:8545/")
);

// ✅ 合约地址（BSC 测试网）
export const AIMEMainAddress = "0x8fb6C61Df2359c722f14595F865a6fe5DC2AD046"; // 主合约
export const USDTAddress = "0x55d398326f99059fF775485246999027B3197955";
export const RISAddress = "0xfFF9D940f0C6E0A7eEcc795B8a05bF0a20129d09";
export const AIMEAddress = "0x637DaA6Ff711169fE677F76B191033F274a80277";
export const AIMENFTAddress = "0x853393CC20A765018Ff21995dA698BC19a527Eb8";
export const AIMEQueryAddress = "0x73F80D7f3EE0d7fAb9Bd606062957f9bAADC2994";
export const Rise_LPAddress = "0x251fa4BE6738cef5D4510412a1712FC1F7d965b4";
export const SGDHAddress = "0x28D94CF277841642b77B1af346789a57306D6db4";
export const AIMESwap = "0xA0A7344a92152D4b64c84dB1B5a50ACdf5fc75eA";
export const WKAddress = "0xb7a4462328b99dD83445d36Bb28dFA19c0f242bb";


// ✅ ABI 引入（确保你项目中对应 .json 文件已转换为合法 JSON 格式）
import AIMEMainABI from "./AIMEMain_ABI.json";
import RIS_ABI from "./RIS_ABI.json";
import AIME_ABI from "./AIME_ABI.json";
import AIMENFT_ABI from "./AIMENFT_ABI.json";
import AIMEQuery_ABI from "./AIMEQuery_ABI.json";
import USDT_ABI from "./USDT_ABI.json";
import Rise_LP from "./Rise_LP.json";
import SGDH_ABI from "./SGDH_ABI.json";
import AIMESwap_ABI from "./AIMESwap_ABI.json";
import WK_ABI from "./WK_ABI.json";

// ✅ 实例化合约对象
export const AIMEMainContract = new web3.eth.Contract(AIMEMainABI, AIMEMainAddress);  // 主合约：合成、查询等
export const RISContract = new web3.eth.Contract(RIS_ABI, RISAddress);                // RIS 代币合约
export const AIMEContract = new web3.eth.Contract(AIME_ABI, AIMEAddress);             // AIME 代币合约
export const AIMENFTContract = new web3.eth.Contract(AIMENFT_ABI, AIMENFTAddress);    // NFT 合约
export const AIMEQueryContract = new web3.eth.Contract(AIMEQuery_ABI, AIMEQueryAddress); // 查询合约
export const USDTContract = new web3.eth.Contract(USDT_ABI, USDTAddress);             // USDT 合约
export const RUSELPContract = new web3.eth.Contract(Rise_LP, Rise_LPAddress);             // Rise_LP 合约
export const SGDHContract = new web3.eth.Contract(SGDH_ABI, SGDHAddress);             // Rise_LP 合约
export const AIMESwapContract = new web3.eth.Contract(AIMESwap_ABI, AIMESwap);             // Rise_LP 合约
export const WKContract = new web3.eth.Contract(WK_ABI, WKAddress);             // Rise_LP 合约
